﻿using System.Collections.Generic;

namespace Asteroids.Entities
{
    public struct ReadOnlyList<T>
    {
        private static ReadOnlyList<T> _empty = new ReadOnlyList<T>(new List<T>());

        private IList<T> _list;

       

        public ReadOnlyList(IList<T> list)
        { _list = list; }

        public ReadOnlyList(IEnumerable<T> items)
        { _list = new List<T>(items); }

        public int IndexOf(T item)
        { return _list.IndexOf(item); }

        public T this[int index]
        { get { return _list[index]; } }

        public bool Contains(T item)
        { return _list.Contains(item); }

        public void CopyTo(T[] array, int arrayIndex)
        { _list.CopyTo(array, arrayIndex); }

        public int Count
        { get { return _list.Count; } }

        public IEnumerator<T> GetEnumerator()
        { return _list.GetEnumerator(); }

        public static ReadOnlyList<T> Empty
        { get { return _empty; } }
    }
}
